﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HSDc.RingleFlow.Kernel.Persistence;
using HSDc.RingleFlow.Api.Kernel;

namespace HSDc.RingleFlow.Kernel.Default
{
    internal class MemoryProcessInstance : WFPersitable
    {
        void WFPersitable.Save(object persistObject)
        {
            IProcessInstance instance = (IProcessInstance)persistObject;
            if (MemoryRuntimeEnvironment.instances.ContainsKey(instance.Id))
                MemoryRuntimeEnvironment.instances.Remove(instance.Id);
            MemoryRuntimeEnvironment.instances.Add(instance.Id, (ProcessInstance)instance);
        }
    }
    internal class MemoryCompleteProcessInstance : WFPersitable
    {
        void WFPersitable.Save(object persistObject)
        {
            IProcessInstance instance = (IProcessInstance)persistObject;
            MemoryRuntimeEnvironment.instances.Remove(instance.Id);
        }
    }
}
